package com.softeem.score.manager.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.softeem.score.manager.mapper.AnnouncementMapper;
import com.softeem.score.manager.service.AnnouncementService;
import com.softeem.score.model.entity.educational.Announcement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author zhu
 * @since 2024-02-14
 */
@Service
public class AnnouncementServiceImpl implements AnnouncementService {
    @Autowired
    private AnnouncementMapper announcementMapper;

    @Override
    public void saveAnnouncement(Announcement announcement) {
        announcementMapper.saveAnnouncement(announcement);
    }

    @Override
    public PageInfo<Announcement> findAllAnnouncement(Integer pageSize, Integer pageNum) {
        PageHelper.startPage(pageNum, pageSize);
        return new PageInfo<>(announcementMapper.findAllAnnouncement());
    }

    @Override
    public void deleteAnnouncement(Long id) {
        announcementMapper.deleteAnnouncement(id);
    }
}
